package ccnu.agile.strategy.restrequest.impl;

import ccnu.agile.bean.request.Request;
import ccnu.agile.config.resthelp.RequestConcurrent;
import ccnu.agile.constant.System;
import ccnu.agile.strategy.restrequest.IRestRequestStrategy;
import org.aspectj.lang.JoinPoint;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Description: Post rest请求参数封装策略类
 * @Author: JreamY
 * @Date: 2021/11/4
 **/
@Service(System.RestRequestStrategy.POST)
public class PostRestRequestStrategy implements IRestRequestStrategy {

    @Autowired
    private RequestConcurrent requestConcurrent;

    @Override
    public void restRequest(JoinPoint joinPoint) {

        Object[] arguments = joinPoint.getArgs();
        Request request = (Request) arguments[0];
        requestConcurrent.putCurrentRequest(request);
    }
}
